require('dotenv').config();
const { getMerchantApplications, getMerchantApplicationDetail } = require('../models/Store');

// 测试获取商家申请列表
const testGetApplications = async () => {
  try {
    console.log('测试获取商家申请列表...');
    
    const result = await getMerchantApplications({
      page: 1,
      limit: 10
    });
    
    console.log('商家申请列表获取结果:', {
      total: result.total,
      count: result.list.length,
      page: result.page,
      limit: result.limit
    });
    
    if (result.list.length > 0) {
      console.log('第一条申请:', result.list[0]);
      
      // 测试获取详情
      const id = result.list[0].id;
      console.log(`测试获取申请详情 (ID: ${id})...`);
      const detail = await getMerchantApplicationDetail(id);
      console.log('申请详情获取结果:', detail);
    }
    
    return '测试成功完成';
  } catch (error) {
    console.error('测试失败:', error.message);
    throw error;
  }
};

// 执行测试
testGetApplications()
  .then(console.log)
  .catch(console.error); 